﻿/*
 * Created by SharpDevelop.
 * User: t_furu
 * Date: 2007/11/07
 * Time: 13:55
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Text;
using System.Runtime.InteropServices;

namespace nicosb.Lib
{
	/// <summary>
	/// Description of Util.
	/// </summary>
	public class Util
	{
		[DllImport("kernel32.dll")]
  		private static extern int GetShortPathName(string longPath, StringBuilder shortPathBuffer, int bufferSize);
  		
		private Util()
		{
		}
		
		//長いパスを短いパスに変換
		public static String GetShortPathName(String longPath){
		    int bufferSize = 260;
		    StringBuilder shortPathBuffer = new StringBuilder(bufferSize);
		    int len = GetShortPathName(longPath, shortPathBuffer, bufferSize);
		    String shortPath = shortPathBuffer.ToString();
		    return shortPath;
		}
	}
}
